package com.heima.article.controller;

import com.heima.article.service.ArticleHomeService;
import com.heima.model.article.dto.ArticleHomeDto;
import com.heima.model.dtos.ResponseResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author 张一恒
 * @version 1.0
 * @description:
 * @date 2023/1/9 16:55
 */
@RestController
@Slf4j
@RequestMapping("/api/v1/article")
public class ArticleHomeController {

    @Autowired
    ArticleHomeService articleHomeService;

    /**
     * @param articleHomeDto
     * @param loadType
     * @return com.heima.model.dtos.ResponseResult
     * @description 页面展示
     * @author 31115
     * @date 2023/1/9 17:01
     */
    @PostMapping("/{loadType}")
    public ResponseResult load(@RequestBody ArticleHomeDto articleHomeDto,
                               @PathVariable("loadType") String loadType) {
        return articleHomeService.load(articleHomeDto, loadType);
    }

}
